#!/bin/bash
#This script starts all services and scripts needed to run cuckoo

base_dir="$HOME"

#set directory variables
cuckoo_dir="$base_dir/cuckoo/"
web_dir="$base_dir/cuckoo/web/"
utils_dir="$base_dir/cuckoo/utils/"
fakedns_dir="$base_dir/malware-intelligence-project/utils/"

#Set ip address of vbox interface

vboxmanage hostonlyif ipconfig vboxnet0 --ip 10.0.0.1
vboxmanage hostonlyif ipconfig vboxnet1 --ip 10.0.1.1
vboxmanage hostonlyif ipconfig vboxnet2 --ip 10.0.2.1
vboxmanage hostonlyif ipconfig vboxnet3 --ip 10.0.3.1
vboxmanage hostonlyif ipconfig vboxnet4 --ip 10.0.4.1
vboxmanage hostonlyif ipconfig vboxnet5 --ip 10.0.5.1
vboxmanage hostonlyif ipconfig vboxnet6 --ip 10.0.6.1
vboxmanage hostonlyif ipconfig vboxnet7 --ip 10.0.7.1
vboxmanage hostonlyif ipconfig vboxnet8 --ip 10.0.8.1
vboxmanage hostonlyif ipconfig vboxnet9 --ip 10.0.9.1
vboxmanage hostonlyif ipconfig vboxnet10 --ip 10.0.10.1
vboxmanage hostonlyif ipconfig vboxnet11 --ip 10.0.11.1
vboxmanage hostonlyif ipconfig vboxnet12 --ip 10.0.12.1
vboxmanage hostonlyif ipconfig vboxnet13 --ip 10.0.13.1
vboxmanage hostonlyif ipconfig vboxnet14 --ip 10.0.14.1
vboxmanage hostonlyif ipconfig vboxnet15 --ip 10.0.15.1


#start monogo
sudo service mongodb start

#start apache2 // not needed but nice for transfering files 
#sudo service apache2 start

#start irc server 
sudo service ircd-irc2 start

#start fakedns for each interface
sudo nohup python $fakedns_dir/fakedns.py 10.0.0.1 10.0.0.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.1.1 10.0.1.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.2.1 10.0.2.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.3.1 10.0.3.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.4.1 10.0.4.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.5.1 10.0.5.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.6.1 10.0.6.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.7.1 10.0.7.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.8.1 10.0.8.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.9.1 10.0.9.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.10.1 10.0.10.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.11.1 10.0.11.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.12.1 10.0.12.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.13.1 10.0.13.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.14.1 10.0.14.1 53 &
sudo nohup python $fakedns_dir/fakedns.py 10.0.15.1 10.0.15.1 53 &



#start most programs in a seperate window
#start cuckoo / cuckoo web / cuckoo rest api / fakedns 
#--tab --working-directory=$web_dir -e "python manage.py runserver 192.168.1.201:8000"
#gnome-terminal --tab --working-directory=$cuckoo_dir -e "python cuckoo.py"  --tab --working-directory=$utils_dir -e "python api.py" &
